package com.xcw.strategy.service.impl;

import com.xcw.strategy.Handle.AbstractHandler;
import com.xcw.strategy.handlerService.HandlerContext;
import com.xcw.strategy.impl.OrderDto;
import com.xcw.strategy.service.DealHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author bhx
 * @Date 2022/7/18 1:57
 * @Description TODO
 */
@Service
public class DealHanderImpl implements DealHandler {

    @Autowired
    private HandlerContext handlerContext;

    @Override
    public String handle(OrderDto orderDto) {
        AbstractHandler instance = handlerContext.getInstance(orderDto.getType());

        return instance.handle(orderDto);
    }
}
